#include <iostream>
#include <memory>
using namespace std;
class B;
class A{
public:
    weak_ptr<B> b_ptr;
    ~A(){
        cout<<"~A"<<endl;
    }
};

class B{
public:
    weak_ptr<A> a_ptr;
    ~B(){
        cout<<"~B"<<endl;
    }
};
void test(){
    shared_ptr<A> a(new A()); 
    shared_ptr<B> b(new B());

    a->b_ptr=b;
    b->a_ptr=a;

}
int main(int argc, char * argv[]){
    test();
    return 0;
}

